'''
登陆
查询余额
取钱
存钱
退出
'''
#备用账户信息
client_list = [
    {'id':'1111', 'code':1111,'name':'Aybe','argent':500},
    {'id':'2222', 'code':2222,'name':'Becky','argent':6000},
    {'id':'3333', 'code':3333,'name': 'Aybe', 'argent':7000}
]
# 查询余额
def yue():
    print('您正在查询余额')
    print('您的余额还有{}元'.format(cli_dict['argent']))
    input('按任意键继续')
    return
# 取钱
def retrier():
    print('请输入您想取出的现金')
    arg = input('')
    cli_dict['argent'] -= int(arg)
    if cli_dict['argent'] < 0:
        print('账户余额不足')
        input('按任意键继续')
        return
    print('您现在的余额为{}'.format(cli_dict['argent']))
    input('按任意键继续')
    return
# 存钱
def save():
    print('请输入您要存入的金额')
    arg = input()
    cli_dict['argent'] += int(arg)
    print('您现在的余额为{}'.format(cli_dict['argent']))
    input('按任意键继续')
    return
# 退出
def quit():
    print('欢迎下次光临')
    return
# 登陆操作

# print('===登陆页面===')
# id = int(input('请输入您的ID：'))
# code = int(input('请输入密码：'))
# for i,cli_dict in enumerate(client_list):
#     if int(cli_dict['id']) == id && :
#         if code != cli_dict['code']:
#             print('密码错误')
#         else:
#             print('Welcome,{}'.format(cli_dict['name'], '\n\n'))
#             while True:
#                 print('选择您要执行的操作')
#                 print('*' * 30)
#                 print('1.查询余额\n2.取钱\n3.存钱\n4.退出')
#                 choix = input()
#                 if choix == '1':
#                     yue()
#                 elif choix == '2':
#                     retrier()
#                 elif choix == '3':
#                     save()
#                 elif choix == '4':
#                     quit()
#                     break
#                 else:
#                     print('请重新输入')


print('===登陆页面===')
id = int(input('请输入您的ID：'))
code = int(input('请输入密码：'))
for i,cli_dict in enumerate(client_list):
    while True:
        if int(cli_dict['id']) == id & code == cli_dict['code'] : # 与运算确认账户和密码信息正确
            print('Welcome,{}'.format(cli_dict['name'], '\n\n'))
            while True:
                print('选择您要执行的操作')
                print('*' * 30)
                print('1.查询余额\n2.取钱\n3.存钱\n4.退出')
                choix = input()
                if choix == '1':
                    yue()
                elif choix == '2':
                    retrier()
                elif choix == '3':
                    save()
                elif choix == '4':
                    quit()
                    break
                else:
                    print('请重新输入')
            break
        elif int(cli_dict['id']) == id & code != cli_dict['code'] :
            print('密码或账户错误')
            id = int(input('请输入您的ID：'))
            code = int(input('请输入密码：'))
        else:
            break

